<template>
  <div
    class="custom-modal-wrap"
    ref="modalWrapRef"
    v-if="visible"
    @click="onClose"
  >
    <div class="custom-modal" @click.stop>
      <div class="custom-modal-content">
        <template v-if="buildDetail.id">
          <div class="title">
            {{ buildDetail.build_name }} - 实景图
            <div class="close-button" @click="onClose">
              <CloseCircleOutlined />
            </div>
          </div>
          <div class="build-real hide-scroller-bar">
            <img :src="buildDetail.dimensional_bg_img" alt="" class="" />
          </div>
        </template>
      </div>
    </div>
  </div>
</template>

<script>
import {
  defineComponent,
  reactive,
  toRefs,
  computed,
  watch,
  toRaw,
  ref,
  nextTick,
} from "vue";
import request from "../../../../common/utils/request";
import store from "../../../../store/index";
import { useRoute, useRouter } from "vue-router";
import utils from "../../../../common/utils/utils";
import { Modal, notification, message } from "ant-design-vue";
import { CloseCircleOutlined } from "@ant-design/icons-vue";
import { BorderBox1 } from "@kjgl77/datav-vue3";

export default defineComponent({
  name: "BuildRealPic",
  components: { CloseCircleOutlined },
  props: {
    visible: {
      type: Boolean,
      default: false,
    },
    buildDetail: {
      type: Object,
      default: () => {},
    },
  },

  setup(props, context) {
    const route = useRoute();
    const router = useRouter();
    const state = reactive({});

    const onClose = () => {
      context.emit("onClose");
    };

    const init = () => {
      console.log("props.buildDetail", props.buildDetail);
    };

    watch(
      () => props.visible,
      (val) => {
        if (val) {
          init();
        }
      }
    );

    return {
      ...toRefs(state),
      onClose,
    };
  },
});
</script>

<style lang="less" scoped>
.custom-modal-wrap {
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  background-color: rgba(0, 0, 0, 0.45);

  .custom-modal {
    width: 120rem;
    height: 80rem;
    margin: 6rem auto 0 auto;
    border-radius: 0.8rem;
    overflow: hidden;

    :deep(.border-box-content) {
      padding: 1.2rem;
    }

    .custom-modal-content {
      width: 100%;
      height: 100%;
      background-color: rgba(0, 77, 145, 0.9);
      border-radius: 3rem;
      box-shadow: inset 0 0 1rem #fff;
      backdrop-filter: blur(0.3rem);

      .title {
        height: 8rem;
        position: relative;
        display: flex;
        justify-content: center;
        align-items: center;
        color: #fff;
        font-size: 2rem;
        font-weight: bold;
        padding-top: 2rem;
        padding-bottom: 2rem;

        .close-button {
          position: absolute;
          top: 0.5rem;
          right: 1rem;
          width: 4rem;
          height: 4rem;
          display: flex;
          justify-content: center;
          align-items: center;
          cursor: pointer;
          font-size: 2rem;
        }
      }

      .build-real {
        overflow: hidden auto;
        width: 100%;
        height: calc(100% - 11rem);
        text-align: center;

        img {
          width: 70%;
        }
      }
    }
  }
}
</style>
